/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cr.ac.una.sive.entidad;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author claribel
 */
@Entity
@Table(name = "TIPO_MARCHAMO", catalog = "", schema = "UNA_SIVE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TipoMarchamo.findAll", query = "SELECT t FROM TipoMarchamo t"),
    @NamedQuery(name = "TipoMarchamo.findByIdTipoMarchamo", query = "SELECT t FROM TipoMarchamo t WHERE t.idTipoMarchamo = :idTipoMarchamo"),
    @NamedQuery(name = "TipoMarchamo.findByNombre", query = "SELECT t FROM TipoMarchamo t WHERE t.nombre = :nombre")})
public class TipoMarchamo implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID_TIPO_MARCHAMO", nullable = false, precision = 0, scale = -127)
    private BigDecimal idTipoMarchamo;
    @Size(max = 100)
    @Column(name = "NOMBRE", length = 100)
    private String nombre;
    @OneToMany(cascade={CascadeType.ALL},mappedBy = "tipoMarchamo", fetch = FetchType.EAGER)
    private Collection<Marchamo> marchamoCollection;

    public TipoMarchamo() {
    }

    public TipoMarchamo(BigDecimal idTipoMarchamo) {
        this.idTipoMarchamo = idTipoMarchamo;
    }

    public BigDecimal getIdTipoMarchamo() {
        return idTipoMarchamo;
    }

    public void setIdTipoMarchamo(BigDecimal idTipoMarchamo) {
        this.idTipoMarchamo = idTipoMarchamo;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    @XmlTransient
    public Collection<Marchamo> getMarchamoCollection() {
        return marchamoCollection;
    }

    public void setMarchamoCollection(Collection<Marchamo> marchamoCollection) {
        this.marchamoCollection = marchamoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTipoMarchamo != null ? idTipoMarchamo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoMarchamo)) {
            return false;
        }
        TipoMarchamo other = (TipoMarchamo) object;
        if ((this.idTipoMarchamo == null && other.idTipoMarchamo != null) || (this.idTipoMarchamo != null && !this.idTipoMarchamo.equals(other.idTipoMarchamo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cr.ac.una.sive.entidad.TipoMarchamo[ idTipoMarchamo=" + idTipoMarchamo + " ]";
    }
    
}
